﻿using System;
using System.Linq;
using System.Web.Mvc;
using System.Diagnostics;
using SusuCMS.Web;

namespace SusuCMS.Web.Controllers
{
    public class HomeController : CmsControllerBase
    {
        [CompressFilter]
        public ActionResult Index(string url)
        {
            Trace.Write("test");

            var website = PageContext.CurrentWebsite;
            var page = PageContext.CurrentPage;

            if (website == null || page == null)
            {
                return HttpNotFound();
            }

            var viewName = string.Format("~/wwwroot/{0}/Views/{1}", website.Identifier, page.PageType.TemplatePath);

            return View(viewName, page);
        }


    }
}
